/*
 * @Description: 公交信息数据模型
 * @Author: yingying.fan
 * @Date: 2019-05-14 15:38:07
 * @Last Modified by: yingying.fan
 * @Last Modified time: 2019-05-14 19:43:17
 */
export default class BusInfoModel {
  /**
   *
   * @param {String} busId 公交编号
   * @param {String} busCard 车牌号
   * @param {String} stationId 站点编号
   * @param {Number} isArrived 1已到站，2即将到站
   * @param {String} busState 车辆状态（拥挤，故障等） -1:抛锚,0:默认正常,1:堵车或数据异常,2:停运
   * @param {Boolean} closeToStation 靠近
   * @param {String} routeId 线路ID
   * @param {String} direction 线路方向
   */
  constructor(
    busId,
    busCard,
    stationId,
    isArrived,
    busState,
    closeToStation,
    routeId,
    direction
  ) {
    this.busId = busId + ''
    this.busCard = busCard + ''
    this.stationId = stationId + ''
    this.isArrived = isArrived === 1
    this.busState = busState
    this.closeToStation = closeToStation
    this.routeId = routeId
    this.direction = direction + ''
  }

  /**
   * 车辆锁定
   * @param {Boolean} isFocused
   */
  setBusFocused(isFocused) {
    this.isFocused = isFocused
  }

  /**
   * 车辆下车提醒
   * @param {Boolean} hasAttention
   */
  setBusAttention(hasAttention) {
    this.hasAttention = hasAttention
  }
}
